var RouteButtonEffect = cc.Layer.extend({
    effectArray: [],

    ctor:function () {
        this._super();
        this.loadEffectNode();
    },

    loadEffectNode:function () {
        function addEffectNode() {
            node = new EffectNode(res.cl_stagemap_local_png);
            this.addChild(node);
            this.effectArray.push(node);
        }
        var node = null;
        for(var i =0 ; i< 3 ;i++){
            var delayTime = cc.delayTime(0.25*i);
            var callback = cc.callFunc(addEffectNode.bind(this),this);
            var seq = cc.sequence(delayTime,callback);
            this.runAction(seq);
        }
    },
});

var EffectNode = cc.Sprite.extend({
    ctor:function (fileName, rect, rotated) {
        this._super(fileName, rect, rotated);
        this.loadAction();
    },

    loadAction:function () {
        this.stopAllActions();
        this.setScale(0.35);
        this.setOpacity(255);
        var time = 0.8;
        var delay = cc.delayTime(time*0.8);
        var fadeOut = cc.fadeOut(time * 0.7).easing((cc.easeExponentialOut()));//设置动画缓冲值
        var delayOut = cc.sequence(delay,fadeOut);
        this.runAction(delayOut);
        var callback = cc.callFunc(this.loadAction.bind(this),this);
        var scaleTo2 = cc.scaleTo(time,1.35);
        var delayCall = cc.delayTime(1);
        var seq = cc.sequence(scaleTo2,delayCall,callback);
        this.runAction(seq);
    },
});


